import request from '@/utils/request';

// 新增老人档案
export const addElderlyProfile = (elderlyProfile) => {
    return request.post('/elderly', elderlyProfile);
};

// 修改老人档案
export const updateElderlyProfile = (id, elderlyProfile) => {
    return request.put(`/elderly/${id}`, elderlyProfile);
};

// 根据ID查询老人档案
export const getElderlyProfile = (id) => {
    return request.get(`/elderly/${id}`);
};

// 模糊查询老人档案
export const searchElderlyProfiles = (userId, fullName, idCardNumber, gender, page, size) => {
    return request.get('/elderly/search', { params: { userId, fullName, idCardNumber, gender, page, size } });
};

// 更新老人状态
export const updateElderlyStatus = (id, status) => {
    return request.put(`/elderly/${id}/status`, { status });
};

// 老人申请绑定家属
export const bindElderlyToFamily = (familyUserId, elderlyUserId) => {
    return request.post('/binding/elderly-to-family', { familyUserId, elderlyUserId });
};